#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Time: 2022/9/17 3:16
# @Author: 张涛
# @Email: xxx@gmail.com
# @File：chanpin_rz_page.py



"""
日志页面
"""



from selenium.webdriver.common.by import By
from pages.base_page import BasePage


class DailyRecord(BasePage):
    tjrz_locator = (By.XPATH,'/html/body/div[5]/div/div[2]/div[2]/div/div[2]')  #添加日志
    rzbt_locator = (By.XPATH,'/html/body/div[10]/div[2]/form/table/tbody/tr[2]/td[2]/input') #日志标题
    rznr_locator = (By.CSS_SELECTOR,'#dialog-log > form > table > tbody > tr:nth-child(3)'
                                    ' > td:nth-child(2) > textarea') #日志内容
    djtj_locator = (By.CSS_SELECTOR,'#dialog-log > form > table > tbody > tr:nth'
                                    '-child(4) > td:nth-child(2) > input.btn.btn-primary') #添加
    dwtsxx_locator = (By.CSS_SELECTOR,'#tab1 > div.back_box.mar-top > div') #定位提示信息

    def tjrz_element(self):
        '''点击添加日志'''
        self.driver.find_element(*self.tjrz_locator).click()

    def rzbt_element(self,rzbt_a):
        '''输入日志标题'''
        self.driver.find_element(*self.rzbt_locator).send_keys(rzbt_a)

    def rznr_element(self,rznr_a):
        '''输入日志内容'''
        self.driver.find_element(*self.rznr_locator).send_keys(rznr_a)

    def djtj_element(self):
        '''点击添加'''
        self.driver.find_element(*self.djtj_locator).click()

    def dwtsxx_element(self):
        dwtsxx_a = self.driver.find_element(*self.dwtsxx_locator).text
        return dwtsxx_a
